<template>
	<view class="page">
		<view class="top">
			<view class="success"><image src="../../static/image/ok.png"></image>报名成功</view>
			<view class="tips">报名成功后会有工作人员您联系！</view>
		</view>
		<view class="img-box">
			<image mode="widthFix" :src="carImg"></image>
		</view>
		<view class="car-info">
			<view class="title">{{infoData.name}}</view>
			<!-- <view class="time">
				<img src="../../static/image/g-biao.png" alt=""/>
				<view class="time-name">{{infoData.execute_time}}</view>
			</view> -->
			<view class="dingwei" v-if="isShow">
				<view class="left">
					<img src="../../static/image/g-dingwei.png" alt=""/>
					<view class="time-name">{{infoData.dealer_name}}</view>
				</view>
			</view>
		</view>
		<view class="btn">
			<view class="btn-box" @click="showTips">
				<view class="top">邀请好友来拼团</view>
				<view class="tips">{{infoData.people_num}}</view>
			</view>
		</view>
		
		<view v-if="bannerInfo.act_is_show">
			<view class="mask" v-show="isGuang">
				<view class="guang-box">
					<view class="image-box">
						<image style="width: 612rpx;" mode="widthFix"  class="guang-tu" :src="bannerInfo.act_banner"></image>
						<button plain="true" class="guang-btn" open-type="openAwemeUserProfile" @openawemeuserprofile="eventHandler" :data-aweme-id="urlData.douyin_num">立即私信主播领取</button>
					</view>
					<image @click="closeGuang" class="cha" src="../../static/image/cha.png" mode=""></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const Api = require('../../utils/api.js');
	const request = require('../../utils/request.js');
	
	export default {
		data(){
			return {
				infoData: {},
				carImg: '',
				isShow: false,
				urlData: {},
				bannerInfo: {},
				isGuang: true
			}
		},
		onLoad(options) {
			console.log(options, "eee")
			let obj = decodeURIComponent(options.infoData)
			this.infoData = JSON.parse(obj)
			this.carImg = options.carImg
			this.urlData = options
			if(this.infoData.dealer_is_show) {
				if(this.infoData.is_design_dealer){
					this.isShow = true
				} else {
					if(this.infoData.dealer_name != "未选择购车门店")  {
						this.isShow = true
					}
				}
			}
			this.getSuccessData()
		},
		methods:{
			showTips() {
				uni.showToast({
					title:'分享直播间给好友完成拼团',
					icon: "none"
				})
			},
			getSuccessData () {
				
				request.http({
					url:Api.leave_success,
					header: {
						// 'content-type': 'application/x-www-form-urlencoded',
					},
					type: 'GET',
					data: {
						special_hid: this.urlData.special_hid,
						nickname: this.urlData.douyin_name,
						phone: this.urlData.phone,
						is_send_sms: this.urlData.is_send_sms,
						cate: 1,
						style_hid: this.urlData.style_hid,
						kol_id: this.urlData.kol_id
					},
					 
				}).then(res => {
					// console.log(res, '333')
					console.log(res.data, 'che')
					this.bannerInfo = res.data
					
				})
			},
			closeGuang() {
				this.isGuang = false
			},
			eventHandler(e) {
			    if (e.detail.errNo) {
				  console.log("跳转抖音号个人页失败", e.detail);
				} else {
				  console.log("跳转抖音号个人页成功");
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.page {
		width: 100%;
		height: 100vh;
		background: #fff;
		padding: 0 32rpx;
		box-sizing: border-box;
		.top{
			width: 100%;
			display:flex;
			flex-direction: column;
			align-items: center;
			.success {
				display: flex;
				align-items: center;
				font-weight: 500;
				font-size: 40rpx;
				color: #222526;;
				margin-top: 64rpx;
				image {
					width: 48rpx;
					height: 48rpx;
					margin-right: 16rpx;
				}
			}
			.tips{ 
				font-size: 28rpx;
				color: #222526;
				margin-top: 24rpx;
			}
		}
		
		.img-box {
			width: 100%;
			margin-top: 40rpx;
			text-align:center;
			image {
				width: 440rpx;
				height: auto;
			}
		}
		
		.car-info {
			width: 100%;
			display: flex;
			flex-direction: column;
			padding: 32rpx 32rpx;
			box-sizing: border-box;
			background-image: linear-gradient(90deg, #F6F7FC 0%, #f6f7fc00 100%);
			border-radius: 8rpx;
			.title {
				width: 100%;
				font-weight: 600;
				font-size: 34rpx;
				color: #222526;
				margin-bottom: 16rpx;
			}
			.time {
				width: 100%;
				display: flex;
				margin-bottom: 10rpx;
				align-items: center;
				img {
					width: 44rpx;
					height: 44rpx;
					position: static;
					margin-right: 10rpx;
				}
				.time-name {
					font-weight: 400;
					font-size: 26rpx;
					color: #222526;
				}
			}
			.dingwei {
				width: 100%;
				display: flex;
				justify-content: space-between;
				align-items: center;
				.left {
					display: flex;
					align-items: center;
					img {
						width: 44rpx;
						height: 44rpx;
						position: static;
						margin-right: 10rpx;
					}
					.time-name {
						font-weight: 400;
						font-size: 26rpx;
						color: #222526;
					}
				}
				.btn-text {
					font-weight: 400;
					font-size: 26rpx;
					color: #3075FE;
				}
			}
		}
		.btn {
			width: 100%;
			box-sizing: border-box;
			margin-top: 48rpx;
			.btn-box {
				width: 100%;
				height: 96rpx;
				background-image: linear-gradient(90deg, #FF6340 0%, #FF943C 100%);
				border-radius: 4rpx;
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				.top {
					font-weight: 500;
					font-size: 32rpx;
					color: #FFFFFF;
				}
				.tips{
					font-weight: 400;
					font-size: 22rpx;
					color: #FFFFFF;
				}
			}
		}
		.mask {
			width: 100%;
			height: 100vh;
			background: rgba(0, 0, 0, .4);
			
			position: fixed;
			top:0;
			left: 0;
			.guang-box {
				
				position: absolute;
				top: 58%;
				left: 50%;
				transform: translate(-50%, -58%);
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				.image-box{
					margin-top:-160rpx;
					position: relative;
					.guang-btn {
						position: absolute;
						bottom: 84rpx;
						left:50%;
						transform: translateX(-50%);
						width: 440rpx;
						height: 80rpx;
						background-image: linear-gradient(90deg, #8D5433 0%, #5D2602 100%);
						border-radius: 40rpx;
						font-size: 30rpx;
						color: #FFFFFF;
						line-height: 80rpx;
					
					}
				}
				.cha {
					width: 64rpx;
					height: 64rpx;
					margin-top: 20rpx;
				}
			}
		}
	}
</style>


<style>	
	button::after {
	      border: none;
	}
</style>